package com.lixin.smartclassroom.ui.home.tab5.activity

import android.widget.CompoundButton
import android.widget.CompoundButton.OnCheckedChangeListener
import com.lixin.smartclassroom.databinding.ActivityContactUsBinding
import com.lixin.smartclassroom.databinding.ActivitySetBinding
import com.lixin.smartclassroom.utils.LoginManager
import com.lixinkeji.base.BaseActivity
import com.lixinkeji.extension.commonDialog
import com.lixinkeji.extension.copyToClip
import com.lixinkeji.extension.hasNotificationManager
import com.lixinkeji.extension.onClick
import com.lixinkeji.extension.openDial
import com.lixinkeji.extension.openNotificationManager
import com.lixinkeji.extension.start

/**
 * Description 设置
 * Author: lwc
 * Date:2023/12/9 11:29
 */
class SetAct : BaseActivity<ActivitySetBinding>() {
    override fun getViewBinding() = ActivitySetBinding.inflate(layoutInflater)

    override fun topBarHide() = false
    override fun startPadding() = true
    override fun title() = "设置"


    override fun iniView() {


    }

    override fun onClick() {
        binding.apply {
            llChangePwd.onClick {
                start(ChangePwdAct::class.java)
            }

            btnSave.onClick {
                LoginManager.logout(this@SetAct)
            }




            switchNotice.setOnCheckedChangeListener { _, isChecked ->
                if (isChecked) {
                    if (!hasNotificationManager()) {
                        openNotificationManager()
                    }
                }else{
                    if (hasNotificationManager()) {
                        openNotificationManager()
                    }
                }
            }

        }
    }

    override fun onResume() {
        super.onResume()
        binding.switchNotice.isChecked = hasNotificationManager()
    }


}